package SA.teacher;

import java.util.Calendar;
import SA.teacher.answer.AnswerActivity1;
import SA.teacher.daily.DailyActivity1;
import SA.teacher.manage.ManageActivity1;
import SA.teacher.notice.NoticeActivity1;
import SA.teacher.R;
import android.app.*;
import android.content.*;
import android.os.Bundle;
import android.view.*;
import android.view.View.*;
import android.widget.*;

public class MainActivity extends Activity {
	final String[] classes = new String[] { "1 - A", "1 - B", "2 - A" };

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);

		Calendar today = Calendar.getInstance();
		TextView todayDate = (TextView) findViewById(R.id.today);
		todayDate.setText((today.get(Calendar.MONTH) + 1) + "월"+ today.get(Calendar.DATE) + "일");

		//////////////TextViews////////////////////////////////////////




		//////////////Notice Button////////////////////////////////////
		TextView noticeBtn = (TextView) findViewById(R.id.notice);
		noticeBtn.setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
				noticeActivity();
			}
		});

		//////////////Main Button//////////////////////////////////////
		ImageView manageBtn = (ImageView) findViewById(R.id.manageBtn);
		manageBtn.setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
				manageActivity();	
			}
		});
		ImageView dailyBtn = (ImageView) findViewById(R.id.dailyBtn);
		dailyBtn.setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
				dailyActivity();
			}
		});
		ImageView answerBtn = (ImageView) findViewById(R.id.answerBtn);
		answerBtn.setOnClickListener(new OnClickListener() {
			public void onClick(View v) {
				answerActivity();	
			}
		});
	}

	//////////////Notice Button////////////////////////////////////
	void noticeActivity() {
		Intent intent = new Intent(this, NoticeActivity1.class);
		startActivity(intent);
	}
	//////////////Main Button//////////////////////////////////////
	void mainActivity() {
		Intent intent = new Intent(this, MainActivity.class);
		startActivity(intent);
	}
	void manageActivity() {
		new AlertDialog.Builder(MainActivity.this)
		.setTitle("반을 선택해주세요.")
		.setItems(classes, new DialogInterface.OnClickListener() {

			public void onClick(DialogInterface dialog,	int which) {
				Intent intent = new Intent(MainActivity.this, ManageActivity1.class);
				intent.putExtra("classname",classes[which]);
				startActivity(intent);
			}
		}).show();
	}
	void dailyActivity() {
		Intent intent = new Intent(this, DailyActivity1.class);
		startActivity(intent);
	}
	void answerActivity() {
		Intent intent = new Intent(this, AnswerActivity1.class);
		startActivity(intent);
	}


}
